﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using ProjectN.Core.Element;

namespace ProjectN.Core.Instance
{
    [ReadOnly(true)]
    public sealed class StaticPage : IPage
    {
        public StaticPage(IElement[] elements, int width, int height, Color? bgColor = null, string? id = null, Guid? guid = null)
        {
            Elements = elements;
            Width = width;
            Height = height;
            BackgroundColor = bgColor ?? Properties.Settings.Default.DefaultBGColor;
            Identity = id ?? Properties.Resources.S_NO_ID;
            Guid = guid ?? Guid.Empty;
        }

        public IElement[] Elements { get; private set; }
        IEnumerable<IElement> IPage.Elements { get { return Elements; } }
        public int Width { get; private set; }
        public int Height { get; private set; }
        public string Identity { get; private set; }
        public Color BackgroundColor { get; private set; }
        public Guid Guid { get; private set; }
        public IElement? GetElement(int id)
        {
            if (id >= 0 && id < Elements.Length)
                return Elements[id];
            else
                return null;
        }
    }
}
